package com.akk.module.hlbpay.model;

import com.akk.PayConstants;
import com.akk.module.hlbpay.util.Des3Encryption;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by Administrator on 2017/10/23.
 */
public class HlbH5PayRequest {

    private String P1_bizType;
    private String P2_customerNumber;
    private String P3_userId;
    private String P4_orderId;
    private String P5_timestamp;
    private String P6_goodsName;
    private String P7_orderAmount;
    private String P8_currency;
    private String P9_period;
    private String P10_periodUnit;
    private String P11_payerName;
    private String P12_idCardType;
    private String P13_idCardNo;
    private String P14_cardNo;
    private String P15_year;
    private String P16_month;
    private String P17_cvv2;
    private String P18_phone;
    private String P19_callbackUrl;
    private String P20_serverCallbackUrl;
    private String P21_orderIp;
    private String P22_channelName;
    private String P23_isIntegral;
    private String P24_desc;
    private String signType;

    public String getP1_bizType() {
        return P1_bizType;
    }

    public void setP1_bizType(String p1_bizType) {
        P1_bizType = p1_bizType;
    }

    public String getP2_customerNumber() {
        return P2_customerNumber;
    }

    public void setP2_customerNumber(String p2_customerNumber) {
        P2_customerNumber = p2_customerNumber;
    }

    public String getP3_userId() {
        return P3_userId;
    }

    public void setP3_userId(String p3_userId) {
        P3_userId = p3_userId;
    }

    public String getP4_orderId() {
        return P4_orderId;
    }

    public void setP4_orderId(String p4_orderId) {
        P4_orderId = p4_orderId;
    }

    public String getP5_timestamp() {
        return P5_timestamp;
    }

    public void setP5_timestamp(String p5_timestamp) {
        P5_timestamp = p5_timestamp;
    }

    public String getP6_goodsName() {
        return P6_goodsName;
    }

    public void setP6_goodsName(String p6_goodsName) {
        P6_goodsName = p6_goodsName;
    }

    public String getP7_orderAmount() {
        return P7_orderAmount;
    }

    public void setP7_orderAmount(String p7_orderAmount) {
        P7_orderAmount = p7_orderAmount;
    }

    public String getP8_currency() {
        return P8_currency;
    }

    public void setP8_currency(String p8_currency) {
        P8_currency = p8_currency;
    }

    public String getP9_period() {
        return P9_period;
    }

    public void setP9_period(String p9_period) {
        P9_period = p9_period;
    }

    public String getP10_periodUnit() {
        return P10_periodUnit;
    }

    public void setP10_periodUnit(String p10_periodUnit) {
        P10_periodUnit = p10_periodUnit;
    }

    public String getP11_payerName() {
        return P11_payerName;
    }

    public void setP11_payerName(String p11_payerName) {
        P11_payerName = p11_payerName;
    }

    public String getP12_idCardType() {
        return P12_idCardType;
    }

    public void setP12_idCardType(String p12_idCardType) {
        P12_idCardType = p12_idCardType;
    }

    public String getP13_idCardNo() {
        return P13_idCardNo;
    }

    public void setP13_idCardNo(String p13_idCardNo) {
        P13_idCardNo = p13_idCardNo;
    }

    public String getP14_cardNo() {
        return P14_cardNo;
    }

    public void setP14_cardNo(String p14_cardNo) {
        P14_cardNo = p14_cardNo;
    }

    public String getP15_year() {
        return P15_year;
    }

    public void setP15_year(String p15_year) {
        P15_year = p15_year;
    }

    public String getP16_month() {
        return P16_month;
    }

    public void setP16_month(String p16_month) {
        P16_month = p16_month;
    }

    public String getP17_cvv2() {
        return P17_cvv2;
    }

    public void setP17_cvv2(String p17_cvv2) {
        P17_cvv2 = p17_cvv2;
    }

    public String getP18_phone() {
        return P18_phone;
    }

    public void setP18_phone(String p18_phone) {
        P18_phone = p18_phone;
    }

    public String getP19_callbackUrl() {
        return P19_callbackUrl;
    }

    public void setP19_callbackUrl(String p19_callbackUrl) {
        P19_callbackUrl = p19_callbackUrl;
    }

    public String getP20_serverCallbackUrl() {
        return P20_serverCallbackUrl;
    }

    public void setP20_serverCallbackUrl(String p20_serverCallbackUrl) {
        P20_serverCallbackUrl = p20_serverCallbackUrl;
    }

    public String getP21_orderIp() {
        return P21_orderIp;
    }

    public void setP21_orderIp(String p21_orderIp) {
        P21_orderIp = p21_orderIp;
    }

    public String getP22_channelName() {
        return P22_channelName;
    }

    public void setP22_channelName(String p22_channelName) {
        P22_channelName = p22_channelName;
    }

    public String getP23_isIntegral() {
        return P23_isIntegral;
    }

    public void setP23_isIntegral(String p23_isIntegral) {
        P23_isIntegral = p23_isIntegral;
    }

    public String getP24_desc() {
        return P24_desc;
    }

    public void setP24_desc(String p24_desc) {
        P24_desc = p24_desc;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    public void encryption() {
        if (StringUtils.isNotEmpty(P13_idCardNo))
            P13_idCardNo =  Des3Encryption.encode(PayConstants.HLB_H5_DES3ENCRYPTION_KEY, P13_idCardNo);
        if (StringUtils.isNotEmpty(P14_cardNo))
            P14_cardNo = Des3Encryption.encode(PayConstants.HLB_H5_DES3ENCRYPTION_KEY, P14_cardNo);
        if (StringUtils.isNotEmpty(P15_year))
            P15_year = Des3Encryption.encode(PayConstants.HLB_H5_DES3ENCRYPTION_KEY, P15_year);
        if (StringUtils.isNotEmpty(P16_month))
            P16_month = Des3Encryption.encode(PayConstants.HLB_H5_DES3ENCRYPTION_KEY, P16_month);
        if (StringUtils.isNotEmpty(P17_cvv2))
            P17_cvv2 = Des3Encryption.encode(PayConstants.HLB_H5_DES3ENCRYPTION_KEY, P17_cvv2);
        if (StringUtils.isNotEmpty(P18_phone))
            P18_phone = Des3Encryption.encode(PayConstants.HLB_H5_DES3ENCRYPTION_KEY, P18_phone);
    }

    @Override
    public String toString() {
        return "CreateOrderVo{" +
                "P1_bizType='" + P1_bizType + '\'' +
                ", P2_customerNumber='" + P2_customerNumber + '\'' +
                ", P3_userId='" + P3_userId + '\'' +
                ", P4_orderId='" + P4_orderId + '\'' +
                ", P5_timestamp='" + P5_timestamp + '\'' +
                ", P6_goodsName='" + P6_goodsName + '\'' +
                ", P7_orderAmount='" + P7_orderAmount + '\'' +
                ", P8_currency='" + P8_currency + '\'' +
                ", P9_period='" + P9_period + '\'' +
                ", P10_periodUnit='" + P10_periodUnit + '\'' +
                ", P11_payerName='" + P11_payerName + '\'' +
                ", P12_idCardType='" + P12_idCardType + '\'' +
                ", P13_idCardNo='" + P13_idCardNo + '\'' +
                ", P14_cardNo='" + P14_cardNo + '\'' +
                ", P15_year='" + P15_year + '\'' +
                ", P16_month='" + P16_month + '\'' +
                ", P17_cvv2='" + P17_cvv2 + '\'' +
                ", P18_phone='" + P18_phone + '\'' +
                ", P19_callbackUrl='" + P19_callbackUrl + '\'' +
                ", P20_serverCallbackUrl='" + P20_serverCallbackUrl + '\'' +
                ", P21_orderIp='" + P21_orderIp + '\'' +
                ", P22_channelName='" + P22_channelName + '\'' +
                ", P23_isIntegral='" + P23_isIntegral + '\'' +
                ", P24_desc='" + P24_desc + '\'' +
                ", signType='" + signType + '\'' +
                '}';
    }

    public String getSign(){
        StringBuffer sb = new StringBuffer();
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P1_bizType);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P2_customerNumber);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P3_userId);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P4_orderId);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P5_timestamp);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P6_goodsName);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P7_orderAmount);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P8_currency);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P9_period);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P10_periodUnit);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P11_payerName);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P12_idCardType);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P13_idCardNo);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P14_cardNo);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P15_year);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P16_month);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P17_cvv2);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P18_phone);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P19_callbackUrl);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P20_serverCallbackUrl);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P21_orderIp);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P22_channelName);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P23_isIntegral);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(P24_desc);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(signType);
        sb.append(PayConstants.HLB_SPLIT);
        sb.append(PayConstants.HLB_SIGNKEY_SAME_PERSON);
        return sb.toString().replaceAll("null", "");
    }
}
